from orm import *
def initialize_data():
    path=r"Books_Data.json"
    data_list=[{'时间':'2021/8/21 09:00:00','项目':'工资','分类':'收入','金额':'20000'},{'时间':'2021/8/21 09:00:00','项目':'聚餐','分类':'支出','金额':'-200'}]
    write_data(data_list,path)
def diplay_bill():
    path=r'Books_Data.json'
    revenue=0
    expenditures=0
    balance=0
    data=read_data(path)
    for bill in data:
        if bill['分类']=='收入':
            revenue+=bill['金额']
        else:
            expenditures+=bill['金额']
        balance+=bill["金额"]
    print(f"支出总金额:{expenditures},收入总金额:{revenue},结余金额:{balance}")

def read_json():
    path=r"Books_Data.json"
    return read_data(path)
def write_json():
    path=r'Books_Data.json'
    data_list =read_data(path)
    write_json(data_list,path)
def wirte_bill():

    new_bill={}
# if __name__ == '__main__':
    # initialize_data()
    # diplay_bill()
import time
time=time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
print(type(time))